import { Component, OnInit } from "@angular/core";

@Component({
  selector: 'strategy-card',
  templateUrl: './strategy.component.html'
})

export class StrategyComponent implements OnInit {
  data = [];
  Data1 = [{
    currentValue: 1.01,
    currentUnit: "小时",
    planUnit: "小时",
    changeValue: 0.21,
    conten: "中心地区平均停电时间",
    planValue: 1
  }, {
    currentValue: 81,
    changeValue: 1.5,
    currentUnit: "分",
    planUnit: "分",
    conten: "第三方客户满意度",
    planValue: 80
  }, {
    currentValue: 50.81,
    changeValue: 2.1,
    currentUnit: "%",
    planUnit: "%",
    conten: "非化石能源占比",
    planValue: 50
  }, {
    currentValue: 4.82,
    changeValue: -1.4,
    currentUnit: "%",
    planUnit: "%",
    conten: "净资产收益率",
    planValue: 6
  }, {
    currentValue: 10834,
    changeValue: 2821,
    currentUnit: "件",
    planUnit: "万件",
    conten: "累计有效专利累计数",
    planValue: 1
  }, {
    currentValue: 8.12,
    changeValue: 8,
    currentUnit: "%",
    planUnit: "万件",
    conten: "境外资产占比",
    planValue: 1
  }];
  constructor() {
    //
  }
  ngOnInit() {
    this.initData();
  }
  initData() {
    let iocnName = [{
      name: "icon-zhanlvetingdianshijian"
    }, {
      name: "icon-zhanlvedisanfangkehumanyidu",
    }, {
      name: "icon-zhanlvefeihuashinengyuanzhanbi",
    }, {
      name: "icon-zhanlvejingzichanshouyishuai",
    }, {
      name: "icon-zhanlveleijishu",
    }, {
      name: "icon-zhanlvejingwaizichanzhanbi"
    }];
    for (let i = 0; i < this.Data1.length; i++) {
      this.data.push({
        currentValue: this.Data1[i].currentValue,
        changeValue: Math.abs(this.Data1[i].changeValue),
        changeStatus: this.Data1[i].changeValue < 0 ? "down" : "up",
        fontStatus: this.Data1[i].changeValue < 0 ? "status_1" : "status_2",
        currentUnit: this.Data1[i].currentUnit,
        planUnit: this.Data1[i].planUnit,
        conten: this.Data1[i].conten,
        planValue: this.Data1[i].planValue,
        iocnName: iocnName[i].name
      });
    }
    console.log(this.data);
  }
}
